package mechanism.classinit;
class A
{
	public static short i = 1;
	static	{
		System.out.println("A loaded");
	}	
	
	A()	{
		System.out.println("class A constructor");
		init(1,2);
	}
	
	A(int a,int b)
	{
		System.out.println("A constructor a="+a+";b="+b);
	}
	
	public void init()
	{
		System.out.println("A init()");
	}
	public void init(int x,int y)
	{
		System.out.println("A init x="+x+";y="+y);
		init();
	}
}
	
class B extends A
{
	static	{
		System.out.println("B loaded");
	}

	B()	
	{
		super();
		//super(3,5);
		System.out.println("class B constructor");
		
		//super.init();
	}

	B(int a,int b)
	{
		super();
		//super(3,5);
		System.out.println("B constructor a="+a+";b="+b);
	}
	
	public void init()
	{
		super.init();
		System.out.println("B init()");
	}

	
	public void init(int x,int y)
	{
		super.init(x,y);
		System.out.println("B init x="+x+";y="+y);
	}

}


class C extends A{}

public class InheritTest {
	public static void main(String args[])
	{
		/*
		try
		{
			Class.forName("garbage.B");
		}
		catch(ClassNotFoundException e)
		{
			e.printStackTrace();
		}
		*/
		B b= new B();
		System.out.println(C.i);
	}
}

class NameA {
	NameA() {
		System.out.println(getClass().getName());
	}
}
class NameB extends NameA {
	NameB() {
		
	}
	
	public static void main(String[] args) {
		new NameB();
	}
}